package cn.iocoder.yudao.module.album.dal.mysql.imgsubject;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.album.dal.dataobject.imgsubject.ImgSubjectDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.album.controller.admin.imgsubject.vo.*;

/**
 * 用户相册 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ImgSubjectMapper extends BaseMapperX<ImgSubjectDO> {

    default PageResult<ImgSubjectDO> selectPage(ImgSubjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ImgSubjectDO>()
                .eqIfPresent(ImgSubjectDO::getUserId, reqVO.getUserId())
                .likeIfPresent(ImgSubjectDO::getName, reqVO.getName())
                .eqIfPresent(ImgSubjectDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ImgSubjectDO::getType, reqVO.getType())
                .eqIfPresent(ImgSubjectDO::getCarouselInterval, reqVO.getCarouselInterval())
                .eqIfPresent(ImgSubjectDO::getVideoDuration, reqVO.getVideoDuration())
                .eqIfPresent(ImgSubjectDO::getIconUrl, reqVO.getIconUrl())
                .eqIfPresent(ImgSubjectDO::getImageUrl, reqVO.getImageUrl())
                .betweenIfPresent(ImgSubjectDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ImgSubjectDO::getId));
    }

}